<?php
class classifyApp extends core
{
	public function mainAction($arg)
	{
		$template	= $this->template();
		$classify	= base::init('classify')->fetchAll();
		$classify	= base::init('classify')->listcls($classify,0);
		$websites	= sort_combine(base::init('website')->fetchAll(),'wid',false);

		$template->assign('websites',$websites);
		$template->assign('classify',$classify);
		$template->display('classify_main.php');
	}
	
	public function renameAction($arg)
	{
		$where	= array('cid'=>$arg['cid']);
		$edit	= array('name'=>$arg['name']);
		if (base::init('classify')->edit($where, $edit))
			print_r('1');
	}
	
	public function addAction($arg)
	{
		if (base::init('classify')->insert($arg))
			$this->refresh('添加成功',"index.php?m=classify&a=main");
	}
	
	public function deleteAction($arg)
	{

	}
}